// Copyright (c) [Year] [name of copyright holder]
// [Software Name] is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2. 
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2 
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
// See the Mulan PSL v2 for more details.

/*!
 * \autor captainpeng
 * \date 2019-5-23
 * \update 2019-5-23
 * \version 1.0
 * \copyright
 */

#ifndef MY_MEMMAN_HPP
#define MY_MEMMAN_HPP

#include<iostream>
// #include"memList.hpp"
// #include"memSplayTree.hpp"
#include"memMark.hpp"
#include"memAVLTree.hpp"

namespace my{

    class memMan{
    public:
        // using listType = memList;
        // using nodePtr = typename listType::nodePtr;
        
        // using treeType = memSplayTree;
        // using treeNodePtr = memSplayNode *;

        using treeType = memAVLTree;
        using treeNodePtr = typename treeType::treeType;

        using markType = memMark;

        // memList
        // static listType & GetList(){
        //     static listType list;
        //     return list;
        // }

        // static void ShowList(){
        //     nodePtr p=GetList().head();
        //     while(p != nullptr){
        //         std::cout<<"[ "<<p->mPower<<","<<p->mValue<<","<<p->mCount<<','<<p->mSize<<" ]"<<std::endl;
        //         p=p->mNext;
        //     }
        // }

        // static void ClearList(){
        //     GetList().clear();
        // }

        static treeType & GetTree(){
            static treeType tree;
            return tree;
        }

        static void ShowTree(){
            GetTree().print();
        }

        static void ClearTree(){
            GetTree().free();
        }
    };
}

#endif
